
<script type="text/javascript">
var companies = <?php echo Zend_Json::encode($this->key_companies);?>;
$(document).ready(function(){
	$( "#inbound_company_code" ).blur(function(){
		if( companies[$(this).val()] == null ){
			$(this).val('');
		}
	});	

	$( "#product_group_code" ).change(function(){
		var tmp=$(this);
		$.ajax({
		   type: "POST",
		   url: "<?php echo $this->url(array("controller"=>"inbound-detail","action"=>"ajax-load-product","module"=>"inbound"),null,true)?>",
		   data: {"product_product_group_code":tmp.val()},
		   success: function(html){
		      $('#inbound_detail_product_code').html(html);
		   }
		 });
	});	
});
</script>

<!-- thanh toolbar -->
<?php $act = (string)$this->inbound_type == '1' ? 'insert-out' : 'insert-in' ;?>
<?php $this->placeholder('toolbar')->captureStart();?>
<?php echo $this->partial('index/toolbar/excel.phtml', 'admin') ?>
<?php echo $this->partial('index/toolbar/excel-all.phtml', 'admin') ?>
<?php $this->placeholder('toolbar')->captureEnd();?>
<!-- / -->

<!-- submenu -->
<?php $this->submenu=array(//class="active"
"Nguyên vật liệu"=>$this->url(array("inbound_warehouse_group_code"=>"NVL")),
"Thành phẩm"=>$this->url(array("inbound_warehouse_group_code"=>"TP")),
"Bao bì"=>$this->url(array("inbound_warehouse_group_code"=>"BB")),
);?>
<!-- / -->

<form id='adminForm' name='adminForm' method='post' action=''>
<dl class="zend_form">

	<!-- phần tìm kiếm -->	
	<div class='formSearh'>
	<fieldset>
		<legend>Thông tin tìm kiếm</legend>
		<?php echo $this->form->adminAction;?>
		<?php echo $this->form->inbound_create_time_a;?>
		<?php echo $this->form->inbound_create_time_b;?>	
		<?php echo $this->form->product_group_code;?>
		<?php echo $this->form->inbound_detail_product_code;?>
	</fieldset>
	</div>	
	<!-- / -->
	
	<!-- danh sách hiển thị -->
	<div class='clr'> </div>
	<fieldset>
		<legend>BÁO CÁO TỔNG HỢP NHẬP XUẤT TỒN</legend>
		<table class='adminlist'>
			<thead>			
				<tr>
					<?php echo $this->partial('index/manage/no-save-order.phtml', 'admin'); ?>
					<th >
						Mã thành phẩm
					</th>
					<th >
						Tên thành phẩm
					</th>
					<th>Đơn vị tính</th>
					<th>
						Tồn đầu kỳ<br/><(A)
					</th>
					<th>
						Nhập trong kỳ<br/>(A)->(B)
					</th>
					<th>
						Xuất trong kỳ<br/>(A)->(B)
					</th>
					<th>
						Tồn cuối kỳ<br/>>(B)
					</th>
				</tr>
			</thead>
			<tbody>
				<?php if($this->paginator){$no=1;foreach ($this->paginator as $product){?>
				<tr>
					<?php echo $this->partial('index/manage/order.phtml', 'admin',array($no++)); ?>
					<td class='is_code'>
						<?php echo $product->product_code?>
					</td>
					<td >
						<?php echo $product->product_name?>
					</td>
					<td><?php echo $product->m_Array['inbound_detail_product_unit_code']?></td>
					<td class="right">
						<?php echo $this->partial('index/format/float.phtml','admin',array($product->m_Array['ton_dau_ki']))?>
					</td>
					<td class="right">
						<?php echo $this->partial('index/format/float.phtml','admin',array($product->m_Array['nhap_trong_ki']))?>
					</td>
					<td class="right">
						<?php echo $this->partial('index/format/float.phtml','admin',array($product->m_Array['xuat_trong_ki']))?>
					</td>
					<td class="right">
						<?php echo $this->partial('index/format/float.phtml','admin',array($product->m_Array['ton_cuoi_ki']))?>
					</td>
				</tr>
				<?php }}?>
			</tbody>
			<tfoot>
				<tr>
					<td colspan='16'>
						<div class='container'>
							<?php if($this->paginator){echo $this->paginationControl($this->paginator);} ?>
						</div>
					</td>
				</tr>
			</tfoot>
		</table>
	</fieldset>
	<!-- / -->
	
</dl>
</form>
